import java.util.Scanner;
//求N的阶乘和
public class Factorial_Sum {

        public  static int facSum(int n){
            if (n == 0) {
                return 1;
            }
           int sum=0;
            for(int j=1;j<=n;j++) {
                int ret = 1;
                for (int i = 1; i <=j; i++) {
                    ret = ret * i;
                }
                sum+=ret;
            }
            return sum;
        }

        public static void main(String[] args) {
            System.out.println("输入整数N");
            Scanner scan=new Scanner(System.in);
            int n=scan.nextInt();
            int ret=0;
            System.out.println(n+"的阶乘为和"+ facSum(n));
        }

}
